package model.shader;

import java.awt.Color;
import java.util.Collection;

import raytracing.RayTracer;

import lib.common.Constants;
import model.lights.Light;
import model.primitive.IntersectionData;

public class MirrorShader implements Shader {
	public String name;
	public Color refl; // reflection color;
	private double reflK;
	
	public MirrorShader(String name, Color refl) {
		this.name = name;
		this.refl = refl;
		this.reflK = 1; // 1 by default
	}
	
	@Override
	public String getName() {
		return this.name;
	}

	@Override
	public void setName(String name) {
		this.name = name;
	}

	@Override
	public Color getColor(Collection<Light> lights, IntersectionData state, RayTracer rt) {		
		if (lights == null || lights.size() == 0 || state == null) {
			return Constants.DEF_COLOR;
		}
		
		// TODO ver si importa las luces en el mirror shader
		return this.refl;
	}

	@Override
	public double getRefractionConstant() {
		return 0.0;
	}

	@Override
	public double getReflectionConstant() {
		return reflK;
	}
	
	public void setReflectionConstant(double reflK) {
		if (reflK < 0) {
			return; // no changes
		}
		this.reflK = reflK;
	}
	
}
